package leetcode_tag.树;

import leetcode.TreeNode;

public class LeetCode100 {

    //递归遍历
    //可以层次遍历
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if (p == null && q == null)
            return true;
        if (p != null && q != null) {
            if (p.val != q.val)
                return false;
            return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
        } else
            return false;
    }
}
